const readline=require('readline')
const rl = readline.createInterface({
  input:process.stdin
})
let buf = []

rl.on('line',(line)=>{
  buf.push(line)
})

rl.on('close',()=>{
  //所有的代码都写在这里
    console.log(buf)
    kc=[]
    kcs=Number(buf.shift())
    console.log(bcs,buf)
    while(buf.length>0){
        let rs=Number(buf.shift())
        kc[kch]=[]
        for(let i=0;i<rs;i++){
            kc[kch].push(buf.shift().split(' ').map(v=>{
                return Number(v)
            }))
        }
        kc[kch].sort((v1,v2)=>{
            return v1[1]-v1[1]
        })
    }
    console.log(kc)
  process.exit(0)
})